# coding=utf-8

import socket
import time

str1 = 'aaaaaaa'
str1_b = str1.encode('latin-1')

str2 = 'bbbb'
str2_b = str2.encode('latin-1')


def s(msg=1):
    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    sock.connect(('localhost', 8002))
    time.sleep(2)
    if msg == 1:
        sock.send(str1_b)
    else:
        sock.send(str2_b)
    print(sock.recv(1024).decode())
    sock.close()


s(1)

s(2)